<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Urun Details</f:facet>

        <s:decorate id="urunno" template="layout/display.xhtml">
            <ui:define name="label">Urunno</ui:define>
            <h:outputText value="#{urunHome.instance.urunno}"/>
        </s:decorate>

        <s:decorate id="adi" template="layout/display.xhtml">
            <ui:define name="label">Adi</ui:define>
            <h:outputText value="#{urunHome.instance.adi}"/>
        </s:decorate>

        <s:decorate id="ambalaj" template="layout/display.xhtml">
            <ui:define name="label">Ambalaj</ui:define>
            <h:outputText value="#{urunHome.instance.ambalaj}"/>
        </s:decorate>

        <s:decorate id="barkod" template="layout/display.xhtml">
            <ui:define name="label">Barkod</ui:define>
            <h:outputText value="#{urunHome.instance.barkod}"/>
        </s:decorate>

        <s:decorate id="upc" template="layout/display.xhtml">
            <ui:define name="label">Upc</ui:define>
            <h:outputText value="#{urunHome.instance.upc}"/>
        </s:decorate>
        
        <s:decorate id="paletadedi" template="layout/display.xhtml">
            <ui:define name="label">Paletadedi</ui:define>
            <h:outputText value="#{urunHome.instance.paletadedi}"/>
        </s:decorate>

        <s:decorate id="kalipBilgisi" template="layout/display.xhtml">
            <ui:define name="label">Kalıp</ui:define>
            <h:outputText value="#{urunHome.instance.kalip.kod} - #{urunHome.instance.kalip.ad}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/UrunEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty urunFrom ? 'UrunList' : urunFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab rendered="#{urunHome.instance.firma == null || authenticator.isAdmin()}">
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Firma</h:panelGroup>
        </f:facet>
    <div class="association" id="firmaParent">

        <h:outputText value="There is no firma associated with this urun."
                   rendered="#{urunHome.instance.firma == null}"/>

        <rich:dataTable var="_firma"
                   value="#{urunHome.instance.firma}"
                rendered="#{urunHome.instance.firma != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="firmaTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_firma.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ad</f:facet>
                <h:outputText value="#{_firma.ad}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Adres</f:facet>
                <h:outputText value="#{_firma.adres}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Eposta</f:facet>
                <h:outputText value="#{_firma.eposta}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Kod</f:facet>
                <h:outputText value="#{_firma.kod}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Mersisno</f:facet>
                <h:outputText value="#{_firma.mersisno}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Telefon</f:facet>
                <h:outputText value="#{_firma.telefon}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Vergino</f:facet>
                <h:outputText value="#{_firma.vergino}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Webadresi</f:facet>
                <h:outputText value="#{_firma.webadresi}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewfirma"
                     value="View"
                      view="/Firma.xhtml">
                    <f:param name="firmaId"
                           value="#{_firma.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab rendered="#{authenticator.isAdmin()}">
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Kalip</h:panelGroup>
        </f:facet>
    <div class="association" id="kalipParent">

        <h:outputText value="There is no kalip associated with this urun."
                   rendered="#{urunHome.instance.kalip == null}"/>

        <rich:dataTable var="_kalip"
                   value="#{urunHome.instance.kalip}"
                rendered="#{urunHome.instance.kalip != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="kalipTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_kalip.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Ad</f:facet>
                <h:outputText value="#{_kalip.ad}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Agirlik</f:facet>
                <h:outputText value="#{_kalip.agirlik}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Firma id</f:facet>
                <h:outputText value="#{_kalip.firma.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Kod</f:facet>
                <h:outputText value="#{_kalip.kod}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Olcubirim id</f:facet>
                <h:outputText value="#{_kalip.olcubirim.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Setmi</f:facet>
                <h:outputText value="#{_kalip.setmi}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewkalip"
                     value="View"
                      view="/Kalip.xhtml">
                    <f:param name="kalipId"
                           value="#{_kalip.id}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
